/**
 * @author: wq
 * @Date: 2017/10/25
 * @Time: 18:09
 * <p>
 * Description:
 *          ***
 */
import axios from 'axios';
import { API_NEW_VERSION, ALL_SERVICE_API } from '../api';

const ORDER_TRUCK_LOAD_MESSAGES = 'order/truck_load_messages/';
const ORDER_TRUCK_LOAD_MESSAGE = 'order/truck_load_message/';

/**
 * 保存整车发布信息
 * @param token
 * @param params
 * @returns {AxiosPromise}
 */
export const saveTruckLoadMessage = params => {
  return axios.post(API_NEW_VERSION + ORDER_TRUCK_LOAD_MESSAGES, params);
};

/**
 * 分页检索整发布信息列表
 * @param token
 * @param params
 * @returns {AxiosPromise}
 */
export const searchTruckLoadMessages = params => {
  return axios.get(ALL_SERVICE_API + '/truck-load-infos', {params: params});
};

/**
 * 根据id，修改状态
 * @param id
 * @param status
 * @returns {AxiosPromise}
 */
export const changeStatus = (id, status) => {
  return axios.post(ALL_SERVICE_API + '/truck-load-infos/' + id + '/status/' + status);
};

/**
 *  根据id，删除整车发布信息
 * @param id
 * @returns {AxiosPromise}
 */
export const deleteTruckLoadMessage = id => {
  return axios.delete(API_NEW_VERSION + ORDER_TRUCK_LOAD_MESSAGE + id);
};

/**
 * 根据id，获取整车发布信息
 * @param id
 * @returns {AxiosPromise}
 */
export const getTruckLoadMessage = id => {
  return axios.get(ALL_SERVICE_API + '/truck-load-infos/' + id);
};
